package com.mini.gateway.core.modules.route.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mini.gateway.core.modules.route.enums.RouteType;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * GatewayRoute
 *
 */
@Data
@NoArgsConstructor
@TableName("tb_route")
public class MiniRoute {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableField("route_path")
    private String path;
    @TableField("route_type")
    private RouteType type;
    @TableField("instance_name")
    private String name;
    @TableField("uri")
    private String uri;
    @TableField("route_order")
    private Integer orders;

    /**
     * 创建时间
     */
    @TableField("gmt_created")
    protected Timestamp gmtCreated;
    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", update = "now()")
    protected Timestamp gmtModified;

    public MiniRoute(RouteType type, String name, String path, String uri, Integer order) {
        this.type = type;
        this.name = name;
        this.path = path;
        this.uri = uri;
        this.orders = order;
    }
}
